/*---------------------------------------------------------------------------
 *-Version :0.1 @ 08/20/2008                                                *
 *-Auther : Chen Ju                                                         *
 *-Auther Eail: sammy105@gmail.com                                          *
 *-Auther site : http://www.kylogs.co/blog                                  *
 *-This file defines all data types and declares all data-structure         *
 *-related funcitons.                                                       *
 *---------------------------------------------------------------------------
 */
#ifndef easyc_ds_h
#define easyc_ds_h
/* define c_stack  */
typedef int eType;
typedef struct easyc_stack{
               int base_size;
               int point;
               eType * base;
               int size;
               eType  (*pop)(struct easyc_stack *);
               int  (*push)(eType,struct easyc_stack *);
               eType  (*get_top)(struct easyc_stack *);
               void (*del)(struct easyc_stack *);
        }c_stack;


/*declare stack funcitons*/
eType easyc_pop(c_stack *);

int easyc_push(eType ,c_stack *);

eType easyc_get_top(c_stack *);

void easyc_del(c_stack *);

c_stack make_stack(int size);



/* define c_linkedlist and c_list */
typedef struct easyc_list{
    struct easyc_list * next;
    struct easyc_list * pre;
    eType element;    
}c_list;

typedef struct easyc_linkedlist{
    int size;
    c_list * head;
    c_list * (*find)(eType,  const struct easyc_linkedlist *);
    int (*contains)(eType, const struct easyc_linkedlist *);
    void (*insert)(eType,const c_list *,struct easyc_linkedlist *);
    void (*append)(eType,struct easyc_linkedlist *);
    void (*remove)(c_list *,struct easyc_linkedlist *);
}c_linkedlist;        

/* declare linkedlist functions */
c_linkedlist linkedlist_make();
c_list *easyc_list_find(eType,  const struct easyc_linkedlist *);
int easyc_list_contains(eType, const struct easyc_linkedlist * );
void easyc_list_insert(eType,const c_list *,struct easyc_linkedlist *);
void easyc_list_append(eType,struct easyc_linkedlist * );
void easyc_list_remove(c_list *,struct easyc_linkedlist *);

/* define c_vector */
typedef struct easyc_vector{
    int size;
    int base_size;
    int actual_size;
    eType *base;
    eType (*get)(int, const struct easyc_vector *);
    void (*set)(int,eType,const struct easyc_vector *);
    eType (*remove)(int,struct easyc_vector *);
    void (*sort)(int (*compare)(const void *,const void *),struct easyc_vector *s);
    void (*add)(eType,struct easyc_vector *);
}c_vector;

/* declare c_vector functions */
c_vector make_vector(int i);
void easyc_vector_add(eType, c_vector *);
eType easyc_vector_get(int, const struct easyc_vector *);
void easyc_vector_set(int,eType,const struct easyc_vector *);
eType easyc_vector_remove(int,struct easyc_vector *);
void easyc_vector_sort(int(* compare)(const void *,const void *),c_vector *s);

/* bi-tree */
/*  hashmap  */

#endif
